<?php
Shop::register('css/shop.css');
$this->renderPartial('/order/waypoint', array('point' => 3));

if(!isset($customer))
	$customer = new Customer;

	if(!isset($billingAddress))
		if(isset($customer->billingAddress))
			$billingAddress = $customer->billingAddress;
		else
			$billingAddress = new BillingAddress;

if(!isset($this->breadcrumbs))
	$this->breadcrumbs = array(
			Shop::t('Order'),
			Shop::t('Payment method'));
			
$form=$this->beginWidget('CActiveForm', array(
			'id'=>'customer-form',
			'action' => array('//shop/order/create&cart_id='.$_GET['cart_id']),
			'enableAjaxValidation'=>false,
			)); 
?>
<?php  $add = $customer->address; ?>
<div class="address-detail">
    <div class="current_address">  
            <p class="choose-other-de radius-5px"><?php echo Shop::t('Shipping address'); ?></p>
            <div class="name"><span>Khách hàng :</span> <?php echo $add->firstname; ?></div>
            <div class="name"><?php echo $add->address.' - '.$add->province; ?></div>
        </div>
</div>  

<div class="shipping-me">
<h3 class="choose-other-de radius-5px"> <?php echo Shop::t('Choose your Payment method'); ?> </h3>

<?php
$i = 0;
foreach(PaymentMethod::model()->findAll() as $method) {
	echo '<div class="row">';
	echo CHtml::radioButton("PaymentMethod", $i == 0, array(
				'value' => $method->id));
	echo CHtml::label($method->title, 'PaymentMethod');
	echo ' ( '.CHtml::tag('span', array(), $method->description).' ) ';
	echo '</div>';
	echo '<div class="clear"></div>';
	$i++;
}
	?>
</div>

<div class="row buttons">
<?php
echo CHtml::submitButton(Shop::t('Continue'),array('id'=>'next'));
?>
</div>

<?php
echo '</div>';
$this->endWidget(); 
?>

<?php
Yii::app()->clientScript->registerScript('toggle', "
	if($('#toggle_billing').attr('checked'))
		$('#billing_information').show();

	$('#toggle_billing').click(function() { 
		$('#billing_information').toggle(500);
	});
"); 